package com.jnshu.service;

import com.jnshu.dto.message.MessageListBackList;
import com.jnshu.dto.task.TaskListBackList;
import com.jnshu.tools.resultUtils.PageBean;
import com.jnshu.tools.resultUtils.ResultBean;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "person", url = "http://localhost:20823")
public interface PersonService {
    /**
     * 后台模糊查询
     *
     * @return
     */
    @GetMapping(value = "/message/list", consumes = "application/json")
    PageBean message(@RequestParam(name = "pageNum", required = false) Integer pageNum,
                         @RequestParam(name = "pageSize", required = false) Integer pageSize);

    /**
     * 后台消息分页
     */
    @PostMapping(value = "/message/list/",consumes = "application/json")
    PageBean messageList(@RequestBody MessageListBackList messageListBackList);

    /**
     * 后台消息详情
     *
     * @param id
     * @return
     */
    @GetMapping("/message")
    ResultBean GetMessage(@RequestParam long id);

    /**
     * 后台消息新增
     *
     * @return
     */
    @PostMapping("/message")
    ResultBean addMessage(@RequestParam(required = false) String title,
                          @RequestParam(required = false) String content,
                          @RequestParam(required = false) String url,
                          @RequestParam(required = false) Integer messageType,
                          @RequestParam(required = false) Integer pushType,
                          @RequestParam(required = false) Long pushTime,
                          @RequestParam(required = false) Integer object,
                          @RequestParam(name = "pageNum", required = false) Integer pageNum,
                          @RequestParam(name = "pageSize", required = false) Integer pageSize);

    /**
     * 后台消息编辑
     *
     * @return
     */
    @PutMapping("/message")
    ResultBean updateMessage(@RequestParam(required = false) Long id,
                             @RequestParam(required = false) String title,
                             @RequestParam(required = false) String content,
                             @RequestParam(required = false) String url,
                             @RequestParam(required = false) Integer messageType,
                             @RequestParam(required = false) Integer pushType,
                             @RequestParam(required = false) Long pushTime,
                             @RequestParam(required = false) Integer object,
                             @RequestParam(required = false) Integer status,
                             @RequestParam(name = "pageNum", required = false) Integer pageNum,
                             @RequestParam(name = "pageSize", required = false) Integer pageSize);

    /**
     * 后台消息删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/message")
    ResultBean deleteMessage(@RequestParam long id);

    /**
     * 修改后台消息上下架状态
     *
     * @param id
     * @param status
     * @return
     */
    @PutMapping("/message/status")
    ResultBean updateStatus(@RequestParam long id, @RequestParam int status);

    /**
     * 后台任务列表
     *
     * @return
     */
    @GetMapping(value = "/task/list")
    PageBean task(@RequestParam(name = "pageNum", required = false) Integer pageNum,
                      @RequestParam(name = "pageSize", required = false) Integer pageSize);


    /**
     * 后台消息分页
     */
    @PostMapping(value = "/task/list/", produces = {"application/json;charset=UTF-8"})
    PageBean taskList(@RequestBody TaskListBackList taskListBackList);
    /**
     * 后台任务详情
     *
     * @param id
     * @return
     */
    @GetMapping("/task")
    ResultBean getTask(@RequestParam long id);

    /**
     * 后台任务新增
     *
     * @return
     */
    @PostMapping("/task")
    ResultBean addTask(@RequestParam(required = false) String title,
                       @RequestParam(required = false) Integer taskType,
                       @RequestParam(required = false) String url,
                       @RequestParam(required = false) Integer pointReward,
                       @RequestParam(required = false) Integer status,
                       @RequestParam(required = false) Integer publisher,
                       @RequestParam(name = "pageNum", required = false) Integer pageNum,
                       @RequestParam(name = "pageSize", required = false) Integer pageSize);

    /**
     * 后台任务编辑
     *
     * @return
     */
    @PutMapping("/task")
    ResultBean updateTask(@RequestParam(required = false) Long id,
                          @RequestParam(required = false) String title,
                          @RequestParam(required = false) Integer taskType,
                          @RequestParam(required = false) String url,
                          @RequestParam(required = false) Integer pointReward,
                          @RequestParam(required = false) Integer status,
                          @RequestParam(required = false) Integer publisher,
                          @RequestParam(name = "pageNum", required = false) Integer pageNum,
                          @RequestParam(name = "pageSize", required = false) Integer pageSize);

    /**
     * 后台任务删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/task")
    ResultBean deleteTask(@RequestParam long id);

    /**
     * 修改后台任务上下架状态
     *
     * @param id
     * @param status
     * @return
     */
    @PutMapping("/task/status")
    ResultBean updateTaskStatus(@RequestParam long id, @RequestParam int status);

    //用户列表
    @GetMapping(value = "/user/list")

    ResultBean selectList(
            @RequestParam(name = "grade", required = false) Integer grade,
            @RequestParam(name = "nickname", required = false) String nickname,
            @RequestParam(name = "status", required = false) Integer status,
            @RequestParam(name = "emailStatus", required = false) Integer emailStatus,
            @RequestParam(name = "startTime", required = false) Long startTime,
            @RequestParam(name = "endTime", required = false) Long endTime,
             @RequestParam(name = "pageNum", required = false) Integer pageNum,
            @RequestParam(name = "pageSize", required = false) Integer pageSize);

    //用户详情
    @GetMapping("/user")
    ResultBean selectByPrimaryKey(@RequestParam Long id);
}
